from os import write
is_print = False

log_file = open("log.txt","w")

console_print = print
def log(*kwargs):
    global log_file
    for content in kwargs:
        log_file.write(str(content)+" ")
        console_print(str(content)+" ",end='')
    log_file.write("\n")
    console_print("")

print = log

def close_log():
    global log_file
    log_file.close()

if __name__ == "__main__":
    print("aa",1,2,"bb")
    print([1,2,3],"111",12)
    print("aa",1,2,"bb")
    print("I'm so zhuai")
    close_log()